#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{

    if(yuvRecordThread == nullptr) {


        yuvRecordThread = new YUVRecordThread(this);
        ui->pushButton->setText("停止录制");

        connect(yuvRecordThread,&QThread::finished,[this](){


            ui->pushButton->setText("开始录制视频");
            yuvRecordThread = nullptr;
        });

        yuvRecordThread->start();

    }else{

        yuvRecordThread->requestInterruption();
    }

}
